#!/usr/bin/env bash

echo -e "\n[archlinuxcn]\nServer = https://mirrors.ustc.edu.cn/archlinuxcn/\$arch\nServer = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/\$arch" | sudo tee -a /etc/pacman.conf
echo -e "\n185.199.108.133 raw.githubusercontent.com\n192.30.253.112 github.com" | sudo tee -a /etc/hosts
sudo pacman -Syu
sudo pacman -S archlinuxcn-keyring archlinux-keyring

echo "config sysmtem"
sudo pacman -S zsh yay wget
chsh -s $(which zsh)
touch "$HOME"/.zshrc "$HOME"/.zshenv "$HOME"/.npmrc
echo -e "source ~/.config/zsh/zshrc" | tee "$HOME"/.zshrc
echo -e "source ~/.config/zsh/zshenv" | tee "$HOME"/.zshenv
echo -e "prefix=/home/KicamonIce/.local/share/npm" | tee "$HOME"/.npmrc
mkdir -p "$HOME"/.local/state/
touch "$HOME"/.local/state/zsh_jump_list

echo "download fonts"
yay -Syu
yay -S - --noconfirm <./fontlist.txt

shopt -s dotglob

echo "init config"
./update down

echo "config git"
sudo pacman -S git
git config --global user.name "Kicamon"
git config --global user.email "kicamonice@gmail.com"
git config --global core.editor "nvim"
git config --global init.defaultBranch 'main'

echo "download nvim config"
git clone git@github.com:Kicamon/nvim.git "$HOME"/.config/nvim
sudo pacman -S bash-language-server \
	clang \
  gopls \
	lua \
	lua-language-server \
	luarocks \
	pyright \
	python \
	python-black \
	python-pynvim \
	shfmt \
	typescript-language-server \
	vim-language-server \
	vscode-css-languageserver \
	vscode-html-languageserver \
	vscode-json-languageserver \
	yazi
npm install -g live-server neovim

echo "running update aur and install package"
yay -S - --noconfirm <./pkglist.txt
